<?php
class ujn_view {
	static function dispatch(ujn_controller $controller_object, $view_name) {

		foreach($controller_object->getViewVars() as $name => $var) {
			${$name} = $var;
		}

		$templates_path = ujn::getCFG('templates_path');
		$view_file = $controller_object->getViewPath($view_name);
		if(is_file($view_file)) {
			is_file(UJN_PATH . 'hookfunc/view.php') && include_once UJN_PATH . 'hookfunc/view.php';
			require_once $view_file;
		} else die("unfound $view_file");
	}
}